Julia - Osnovna sintaksa - nizovi, torke, skupovi

In [1]:
#U okviru ove lekcije daćemo detaljninnji prikaz bitnijih izvedenih struktura podataka koji se 
#nalaze u okviru programskog paketa Julia.
In [23]:
#NIZOVI

#Nizovi predstavljaju uredjenu strukturu podataka ne obavezno istog tipa kod kojih za svaki element u nizu postoji
#tačno određeno mesto u nizu kome on pripada tj. postoji uređenost elemenata niza. Kod njih indeksiranje kreće od 
#broja 1

niz_primer1 = [1,  3, 5];    #niz kod koga su svi elementi istog tipa
niz_primer2 = [1,  "jabuka", 5.6];  #niz u kome imamo elemente različitih tipova
In [4]:
#Definisanje nizova

#Ukoliko želimo da imamo niz kome unapred znamo vrednosti, kao i koje su to vrednosti, njega možemo definisati 
#prostom naredbom uvođenja promenljive gde će sa leve strane operatora dodele vrednosti stajati ime promenljive kojoj
#dodeljujemo naš niz, a sa desno strane će stajati izraz koji je ograničen uglastim zagradama, gde će se element po 
#element niza navoditi, medjusobno razdvojeni zapetama. Na primer:

niz_primer3 = [1,  3.5, 1000 , 500]
Out[4]:
4-element Array{Float64,1}:
    1.0
    3.5
 1000.0
  500.0
In [8]:
#Sintaksa definisanja neinicijalizovanih nizova dobija se na sledeći način: 
#Izraz sa leve strane operatora dodele predstavlja kao
#i do sad promenljivu kojoj dodeljujemo naš niz. Izraz sa desne strane predstavlja kombinaciju sintaksnih elemenata
#koji služe za definisanje osobina našeg niza, pa generalna forma za definisanje sledećeg niza ima sledeću formu:

#array = Array{DataType}(undef, dim1, dim2, ..., dimN) - DataType predstavlja tip podataka koji želimo da smeštamo 
#u naš niz , dok dim1, dim2, ..., dimN predstavlja brojeve elemenata koji će se nalaziti u odgovarajućim dimenzijama
#našeg niza - kao rezultat dobijamo niz čiji će elementi biti slučajno izabrani

#Primer:

niz_primer4 = Array{Int32}(undef,2,2)
Out[8]:
2×2 Array{Int32,2}:
 -1  -1471875232
 -1        32726
In [9]:
#Takođe, moguće je definisati i prazan niz, koji posle služi za neke dalje obrade
niz_primer5 = []
Out[9]:
0-element Array{Any,1}
In [15]:
#MATRICE

#Matrice predstavljaju dvodimenzionalne nizove, kao i jednu od najvažnijih matematičkih struktura u obradi podataka.
#To je pravougaona šema brojeva, dimenzija m x n, gde m predstavlja broj vrsta naše matrice, a n broj njenih kolona. 
#Ovo se može interpretirati na sledeći način: Matrica formata m x n predstavlja m nizova dužine n poređanih po nekom
#poretku, gde je svaki od nizova dužine n.
#U programskom jeziku Julia, matrice se definišu na sledeći način: redom po vrstama navodimo elemente naše matrice. 
#Primenom operatora ; vršimo prelazak u novi red. U tom slučaju, ovde ne možemo imati operator zapete koji bi
#vršio razdvajanje elemenata matrice

matrica_primer1 = [1  4; 1000 2000]
Out[15]:
2×2 Array{Int64,2}:
    1     4
 1000  2000
In [16]:
#Za sad ćamo dati prikaz kreiranja nekih specijalnih nizova i matrica, ali ovde neće biti kraj priče o nizovima. 
#U toku kasnijih lekcija vraćaćemo se na nizove, što zato što su nam onu potrebni za realizaciju nekih drugih
#funkcionalnosti, što jer još uvek nismo uveli neke druge jezičke strukture za rad sa njima (npr. petlje)
In [18]:
#Kreiranje niza i matrice koji se sastoje od svih 0

niz_nule = zeros(1,1000); #niz dužine 1000 koji sadrži sve 0
matrica_nule = zeros(4,2); #matrica sa 4 vrste i 2 kolone koja sadrži sve 0

#Kreiranje niza i matrice koji se sastoje od svih 1

niz_jedinice = ones(1,1000); #niz dužine 1000 koji sadrži sve 1
matrica_jedinice = ones(4,2); #matrica sa 4 vrste i 2 kolone koja sadrži sve 1

println("niz_nule: "); print(niz_nule); println("");
println("niz_jedinice: "); print(niz_jedinice); println("");
println("matrica_nule: "); print(matrica_nule); println("");
println("matrica_jedinice: "); print(matrica_jedinice); println("");
niz_nule: 
[0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0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 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0]
matrica_nule: 
[0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0]
matrica_jedinice: 
[1.0 1.0; 1.0 1.0; 1.0 1.0; 1.0 1.0]
In [1]:
#Konacno, generisaćemo niz i matricu kod kojih su elementi niza slučajne promenljive sa uniformnom raspodelom 
#od 0 do 1.

niz_unif = rand(1,1000); #niz dužine 1000 koji sadrži brojeve koji su realizacije slučajne promenljive 
                         #sa unif raspodelom na integrvalu od 0 do 1
matrica_unif = rand(4,2); #matrica sa 4 vrste i 2 kolone koji su realizacije slučajne promenljive 
                         #sa unif raspodelom na integrvalu od 0 do 1

println("niz_unif: "); print(niz_unif); println("");
println("matrica_unif: "); print(matrica_unif); println("");
niz_unif: 
[0.2511105156605242 0.8271002615032512 0.4341902200877523 0.7624771667965857 0.4970642514264465 0.3725258136023526 0.17718544780626622 0.22846439003844687 0.9953958121116353 0.5305811327571064 0.5557305696753996 0.5736652534887845 0.370314735902733 0.37519465019687015 0.7785953359980609 0.7984275216025931 0.06789934693479216 0.6956783842491325 0.7252861888727891 0.9747739225419216 0.0548726000027675 0.9753156482251824 0.421025552019447 0.7811748306734998 0.49379802331667144 0.8846980397471966 0.6746685528020242 0.4601543303910123 0.3011482349960033 0.3271691030782935 0.3969928094234454 0.16026645835118813 0.9119804853783327 0.8600416758731262 0.9634963948921265 0.8447656048368892 0.1970685632297895 0.8030529857294892 0.2822650714748496 0.2028015010803479 0.05129609388308776 0.9356349537668462 0.7134378314952612 0.6546195897608305 0.14520483279208762 0.8945636421145295 0.19599609621542768 0.18385011127480544 0.232931922002503 0.7762901536900548 0.7446152885069701 0.8751913566448299 0.03268059925761779 0.46923239260582617 0.29321217973291147 0.911831971037782 0.30842986722281696 0.26427133180441786 0.0872868684951118 0.6996360883062538 0.2411005956037402 0.4052369432602645 0.4759873882918597 0.3878112552759543 0.9314575078761487 0.04691079130027398 0.296865310318007 0.9660658235253132 0.24478521758093086 0.2635509207286786 0.41299378609929405 0.5523783053773055 0.38413318559828546 0.38510962845429186 0.23633149400219766 0.04054556229330242 0.9298582612914599 0.9135697575251263 0.046115109286430034 0.5434415713843905 0.6281802107845669 0.22830818355670068 0.46272223337660745 0.7199096600087367 0.5709518986700455 0.17324767662784235 0.5304697193738781 0.8422446769378218 0.27897191543096533 0.18534754348216098 0.4701171356030902 0.1467792758648936 0.6920857178254869 0.5708618486812833 0.7041231894335724 0.2899845637819345 0.346199583146954 0.08902663656612142 0.4031937494255353 0.3185554669356807 0.9751247136431314 0.8783911380088683 0.04333465319944141 0.29231462949017417 0.29501625188400227 0.4955398181073236 0.3558402080791492 0.8553963055514557 0.28836033445736087 0.8056257148817219 0.3434317706633119 0.5737639479651699 0.6018796040707632 0.15131874280141222 0.3043861650202617 0.9518817366466938 0.11448255847642108 0.35935353018502925 0.5825040908087424 0.40801681177192695 0.6667016517321052 0.15871135943936965 0.20409403631605905 0.3990219330282323 0.24440604585462422 0.44227108748732147 0.8174444829482346 0.8561259418583851 0.9414412853003815 0.9837076268581755 0.311345633083405 0.6770284719164581 0.544674381305063 0.173256530899232 0.686371722536357 0.930608371160967 0.862845544935041 0.9488967493484122 0.9144342261653373 0.710249091096057 0.5326599037812336 0.5707668692510419 0.7868597164426678 0.837934161613269 0.22323943286737324 0.49993034655462054 0.14060440624142867 0.4626445961936245 0.9485833095842502 0.5743867845927955 0.09541162947989368 0.47724285051427384 0.9225299728322147 0.20957709554785975 0.6537869045230285 0.25801490625941725 0.36487193874446744 0.38227902538717307 0.8159086148461403 0.6099458719193558 0.7838275219565196 0.40932712944389515 0.9785106981888219 0.8298481921836554 0.3544273563491751 0.5611672983380229 0.9440741510922492 0.4289479025974936 0.12103219093955797 0.5502749478846711 0.7118287330878548 0.779607669317754 0.4089613949793087 0.7650000931119139 0.6045243443379329 0.6873057465113925 0.8277199774502721 0.5592570709179043 0.6663693358324165 0.4049596719927604 0.6263017439636926 0.03834254660171199 0.976250014431775 0.9679676480156871 0.9267628765324405 0.809609656049987 0.37218941802961036 0.3812736312395628 0.2960582655622199 0.6399710351717631 0.9318402942276309 0.9992966124005422 0.012470210704397244 0.9704745529239596 0.0983745809021761 0.634486098736553 0.11946045029339492 0.6896419895978223 0.5235397505514798 0.1654125959632653 0.32346588777168095 0.3770131010199138 0.8607892405758564 0.44683295196214434 0.9597345831292852 0.7984352779048893 0.05366530300551853 0.9184097183351128 0.017347742356913054 0.5560890624999366 0.050227644566852137 0.4767303394693254 0.23469694819092157 0.4785570044828469 0.4162502479298471 0.9294370561151499 0.253721470581626 0.34204125466815793 0.3272804259668134 0.10711622570098567 0.8859876831353659 0.37090203999817595 0.437432744533522 0.515377918197508 0.5475209841305146 0.8381930900109564 0.32204421341203027 0.7547222157206492 0.14962324984130704 0.9871511174385388 0.9960721226370337 0.8923760254625737 0.6882734604262415 0.743650334272292 0.9248851000580272 0.6353521841031646 0.8809998414537681 0.5952375331439375 0.23488045285876047 0.00552238701175245 0.2826816938615284 0.9867371051597382 0.13828844696916365 0.7195439461603068 0.07808141783439182 0.32835265683996884 0.3078570215177394 0.3101892221207949 0.8993354896073316 0.931603410219453 0.6048801741231886 0.6983242779420846 0.18431720050229683 0.42191452660854134 0.3279929998903752 0.6915805011020122 0.3445216205846844 0.31504084194568627 0.12280815124634659 0.7009054105180978 0.2674383444178703 0.3884631726165575 0.9281119300754359 0.7074733356743714 0.6995124486054876 0.2717410988391895 0.6443071699611185 0.9718105617417105 0.4442468562681665 0.5741341450299562 0.05967607696954347 0.7323716563237566 0.843951929061888 0.516614079910553 0.7438923410662819 0.9265444049084495 0.5847232509351064 0.6266681759071755 0.5035336783240025 0.7797727462787434 0.09185435261805819 0.9964086211629148 0.46974748471521166 0.4481449797200252 0.439317879645732 0.20504765715123985 0.7382942587707255 0.7140209895468339 0.1713179679100214 0.8633835036438786 0.04856632100220737 0.08857591174501533 0.08632763656984155 0.8349196123049851 0.6228690148308051 0.5180024522092495 0.09754138287547187 0.37260894079885487 0.8502494459029104 0.25083227844504896 0.8863855352750905 0.8344663151439318 0.23292305988121953 0.07805312835909328 0.23307135846968818 0.5849014625301558 0.9203214944191254 0.7241300829307995 0.8112755852956959 0.33457524918326054 0.06963304141737248 0.4572049313051729 0.2370745707864046 0.7818571009185449 0.5865158246528781 0.21984864735873555 0.47313774906769246 0.596629815286758 0.8081149492006918 0.47486084206251866 0.3446899204151015 0.7088049451000693 0.17643710025200599 0.5849703509721516 0.30194545055564714 0.05276277861490919 0.5342188994854793 0.2752372042682125 0.4998441119100372 0.3922506004310864 0.6561220581761695 0.4329530634537111 0.7299012345647715 0.7716185078867575 0.43196363392822623 0.04197715710904326 0.967778750464237 1.3713799693171325e-5 0.06251950066758738 0.13498988836145864 0.969097123595154 0.8068302290010532 0.17742597448905562 0.5271167298144657 0.7604423962392779 0.7960807344054512 0.661517213988857 0.6512527401522785 0.1332512154636063 0.2518730487853291 0.8288364219602125 0.6212649526427794 0.16977766069411482 0.7198492203334113 0.5066467283749552 0.40119134229713493 0.9547107391494467 0.3433341906930558 0.23454813731680102 0.018783282373072474 0.770421177584077 0.25277384738576036 0.01745939705164168 0.027125713856825717 0.1904762902360735 0.8555004449338501 0.4696096674157344 0.08203158739111749 0.19964906673665395 0.3468483011545962 0.49490201698081115 0.502226182413871 0.22604390798564777 0.28061556561437095 0.401434226529658 0.681796616425717 0.22804959265002522 0.8836498002049629 0.7712882725113843 0.7154962056043161 0.8336093075466622 0.013096930958979458 0.260947108951594 0.48098091342819793 0.7405189298384789 0.7654100976791478 0.03502671433565352 0.1392961513744677 0.41783321832327136 0.5377182301903423 0.8516363029774543 0.9932358098002476 0.820171716565725 0.6158361356128528 0.596280735269274 0.9946172663329034 0.8264510588649527 0.007827488389147375 0.886516284859928 0.6228931726921121 0.28299468256143867 0.449681595730695 0.7756845457747112 0.07710363458842417 0.9982076624738558 0.6706685784694957 0.19912635658343203 0.5271797673875429 0.2295592705027789 0.11964293801084724 0.7062442929256785 0.3011680278595261 0.8867653023806945 0.5136102114009848 0.8645546826922024 0.2589363000040217 0.3893836190688811 0.6338588605655515 0.19665257584090035 0.09234634021592902 0.9612012764770173 0.8315638656100068 0.17817500548356935 0.29777662337009225 0.33912557275413757 0.9037262366289107 0.7134848300556016 0.31636355427643914 0.16889827376035393 0.3437814335454741 0.39025382196188096 0.05864596232366792 0.7041708255159855 0.9700723076659821 0.9127534671539923 0.28578833318517827 0.830456618787691 0.5344678818831632 0.24009690663045102 0.2420986504271896 0.6470845010878039 0.09166414983527948 0.14588103534478614 0.730210465765103 0.4885523606654456 0.6644105542886654 0.8461071883829929 0.7716704042951912 0.4131567922113988 0.9378366120346664 0.3177509707940256 0.7982136280862617 0.09747308197134252 0.1052515466923929 0.5552107408327804 0.021963651390183525 0.08863406391654793 0.9280567133985169 0.4367092731633102 0.9436406393196564 0.9546680815750124 0.1561647236521171 0.28030317610907196 0.8889539921052549 0.7224385185389659 0.8048758705791181 0.0338143084381044 0.9140332328030405 0.49767815922520575 0.83536866892849 0.7322341703614752 0.713861211409579 0.9019430888715865 0.6981170381507142 0.9935371007928868 0.7789304311245959 0.6517249405297749 0.19012656042707055 0.3232860770103163 0.8234344084412171 0.3618786026891958 0.12980231546849308 0.08220770180478598 0.26399566756538095 0.9865227137345969 0.21808263716208653 0.2451611285152897 0.6123738959593004 0.25859537244736264 0.7910460063158202 0.5446360672359354 0.30918604255946414 0.8093449793769731 0.4342674432029463 0.6962979318659006 0.5442420090428646 0.9283414653773703 0.2835440676534613 0.18921786488245362 0.963668512320444 0.4066833418965572 0.39186326820024564 0.5820980342092299 0.8687740678399256 0.7903508956491658 0.9142988630542979 0.14460985735983667 0.8691488285950577 0.16220876461181555 0.33936734863357354 0.664755627454569 0.6141780347710957 0.12707217791879155 0.7563549101295846 0.8665401714498571 0.7768729646308554 0.7766403850423744 0.9790625225677951 0.8249411826903257 0.6510118813158485 0.12501883705526673 0.05560894395239013 0.7949864810513716 0.021691604258065267 0.7512365917720192 0.8440483492046329 0.08953177285197422 0.8786060457609344 0.1379517730387112 0.44686885244281616 0.8492316793919692 0.5695978742156775 0.45412924769753227 0.64968678937053 0.572479819392024 0.47470968781770884 0.6519527435111039 0.8752832028872195 0.6493038257822723 0.5646099253223322 0.7042401741211377 0.6409434263040898 0.37511908068247934 0.6590632257699083 0.363352123538615 0.5080344544403526 0.04038563813763951 0.7296471141695406 0.14984562666318424 0.6816641589134609 0.40888364605236194 0.2728828356171431 0.5503379495984686 0.0974905923805287 0.8719997683812604 0.49214963340411133 0.24018962137949607 0.7603476607751332 0.7371101234554436 0.5854056098248452 0.6812716149163351 0.8679466824479558 0.76572538348778 0.6342608427002705 0.8060252959093395 0.32035835070065444 0.7717095068612692 0.9964979574535795 0.6819284987769616 0.33604312193959274 0.2564473746117746 0.2161190930232657 0.05513987649458674 0.6313122839766341 0.8294690040719523 0.45684659656783655 0.32209460785875055 0.1854456172879817 0.00682475229104762 0.5066029217647583 0.9128849046708107 0.8724879027046148 0.04937270426089646 0.4477658951826653 0.47192558991667655 0.5914958845115499 0.5509198162953695 0.14887934112635226 0.6583644250133627 0.6635418321410052 0.5043098630697964 0.9167872927225056 0.6080202054158896 0.9365033409538537 0.6848737674146728 0.14382901234179224 0.02391286582863339 0.4701213168004543 0.7628622643650658 0.20222696512326732 0.4370405061919205 0.9673185754965945 0.5520438160577406 0.355037180776401 0.20943159969232217 0.5295364426842144 0.01814162419110099 0.3149702401674268 0.7041114122415799 0.627725976194137 0.2952020525229495 0.1871891616583936 0.9731761548414153 0.6253604449691024 0.3453614783689849 0.8168835927002243 0.5180341029707642 0.27218053371523476 0.8945127446676555 0.9474333517718754 0.9951233009969314 0.5403842828673 0.10468478399174042 0.12032051170925384 0.42768091187567103 0.11915379291534234 0.4746860734201186 0.3793499521575854 0.7835553240614341 0.6699465386385772 0.30588393573072636 0.8814337646013006 0.18021640573155961 0.4789551002913559 0.2554575106914718 0.49013271656044455 0.9400234172181228 0.292612339857373 0.9061700422481296 0.8936315475142547 0.8140788100086593 0.12657190200132762 0.21772034193776157 0.911402745845542 0.9525136348572836 0.22127889161007497 0.5596998304219969 0.8566638829627908 0.5492675497465787 0.5002549351860834 0.19677335789375472 0.8091226138289536 0.031803105946297094 0.6182075322762404 0.3277151079836418 0.8362934352689568 0.7693730745614487 0.5308993139549087 0.634598748749136 0.6067331518649333 0.664044022989708 0.5304669834317828 0.18760427837811533 0.590996302989377 0.8911172943957169 0.6547910215791231 0.026379210762047967 0.9767192457474922 0.05133145277782103 0.3934847429015216 0.2823101718489214 0.16141620360015518 0.8371953444112581 0.8819191352521043 0.8738288192024979 0.4743241299480383 0.3082941047405712 0.9567333669986398 0.4062737296786014 0.1840932239760522 0.8592824793373699 0.8650524964977109 0.4458012733365595 0.6853638248158416 0.7943967963907725 0.724997829630585 0.23142938912045263 0.07367991019136433 0.4953534103494315 0.990664843964038 0.7888579421952671 0.905327814053043 0.505245576751894 0.2899170934006099 0.9113762359417663 0.09271288463129523 0.656198253719672 0.03806603592488145 0.6681064325238151 0.4591810072452158 0.423666553071252 0.06908350827247434 0.10090540419760496 0.2510378959823829 0.4359131457100931 0.07297863685123374 0.5742521894880215 0.35112716889745244 0.034102958578484444 0.7622736431183001 0.09933667908009669 0.49962923277892646 0.9970954458677357 0.2563503942432903 0.13836715603451966 0.3792350099653423 0.48783593891911226 0.8922862445235111 0.06555087247478997 0.5340945346732593 0.8083400552184805 0.9325331184388039 0.10439350394991509 0.14304600177564453 0.8850924710860417 0.04491281779672884 0.10106337060092807 0.653494361136111 0.08814898220842249 0.24354074801527914 0.3367136000579398 0.14176990677482015 0.6563800789064862 0.7497076485866974 0.8620461717885881 0.37809641785384707 0.5433416666307957 0.34395774093411924 0.08224822280255384 0.7929177611113349 0.3745728930148662 0.7060126986020157 0.8221357038662063 0.1269593182319808 0.5842876041746974 0.6963999109628494 0.8262631489966308 0.9510692478426952 0.44421088595889646 0.6210668805475583 0.8208442176746515 0.9106589419768112 0.266916057705332 0.07499925709271249 0.6891615052051527 0.668182047806462 0.9340313024210505 0.4787355126620021 0.5931788570539849 0.20173461713568264 0.7948166509875552 0.35653998657511576 0.6249923052179427 0.6559993811066029 0.39982139364754854 0.6900644999602261 0.08813406341837338 0.7247653707400603 0.5672961628755042 0.7364059320126088 0.4172402312829804 0.44007637607422057 0.9427405335076657 0.43204944341164664 0.15371866897812092 0.2135504376938373 0.7464259420669708 0.04090341923434315 0.9857647001878764 0.1274117422942922 0.12636755699407765 0.2523812591260137 0.8918883221159011 0.3595476057115534 0.8008393459254997 0.6166640978421993 0.6977573137924828 0.8155223906825848 0.5887485608682181 0.3630296047717221 0.15975729149555584 0.9450603875932011 0.6551593125792363 0.025147976041091535 0.6401161982550467 0.34906952638482314 0.8257373352711739 0.24266395102317495 0.5714096589793729 0.2484833104897426 0.2063264263373421 0.9029792008194131 0.5181382434478161 0.23231878352359803 0.1991918530510186 0.3819752573947144 0.6403146326231917 0.7632647976311304 0.7626539346374093 0.4692651615119148 0.6546637036460712 0.634690398661516 0.8296373008946232 0.3996785900906328 0.8050968249270978 0.7771460087834021 0.568388516743946 0.6793263924015587 0.5966246245892695 0.5199424649603046 0.9997270270611678 0.61529505073344 0.5722407992494656 0.48865141419239144 0.6818043341429576 0.3083293264214757 0.41082503026347883 0.2868687614136731 0.26855230695389265 0.2663807645606695 0.42429976464355823 0.69897867682075 0.9742488573287538 0.7556158853664998 0.14352580899775536 0.879212604251586 0.13443311117725165 0.7792574203630649 0.7892322814670552 0.2586829659435026 0.9144979638746042 0.2181653504873884 0.12484952005349825 0.7254884076146482 0.6980136871948708 0.6205656433401054 0.4198965392685421 0.6993488106029457 0.6390548708469399 0.23891391456496125 0.6892010020674344 0.750123109946752 0.6381989891299562 0.5928018555345116 0.2366983208334854 0.9913702470005656 0.914683992999304 0.09929690614387643 0.7280649990424994 0.4211140167826808 0.980737199434109 0.6328530773015533 0.12755060537294605 0.6311859463344862 0.3875874851954846 0.5823734114381578 0.20903381884024408 0.5520382652420519 0.8842991069712485 0.5452260894810972 0.8881844150649965 0.09046344720092625 0.45093956651706346 0.4183308465152884 0.5043364740274503 0.9907480968733609 0.804736718741659 0.08353316442767111 0.7127175406479389 0.5969411714511677 0.5909531909173622 0.9629713800636646 0.3336542603454904 0.18635784742337025 0.021483464234202332 0.2779881802714199 0.48319754076465693 0.2517544709878925 0.7660627806101528 0.3831524988278412 0.7813711300956117 0.43220207711013914 0.7762126935376428 0.29950207164423204 0.05031289767140512 0.831733656084819 0.1457637309639339 0.309288141361024 0.6712298967831476 0.6424042557852199 0.9928105314949203 0.17517738816542194 0.16909702264023374 0.7368976075846496 0.8999166470173261 0.741158362132933 0.1961478767260898 0.2749444655173192 0.5296734177263969 0.9013056251258706 0.37114061154884714 0.7919784909561589 0.5189783018997987 0.8256976449588027 0.7093657949618473 0.7390158414685428 0.31225466081081965 0.9124192310700121 0.0227972823093614 0.0025962166702548917 0.13299068508766787 0.6860160265573774 0.8014310945209588 0.679118153188216 0.8221618502695056 0.6551494125722992 0.2064170937523515 0.540321900349247 0.10221662450718783 0.11982795239837563 0.782684239683646 0.5065763754420038 0.20934550346787018 0.2757985540976473 0.22693546288925748 0.9666752166079366 0.2110379853495612 0.9119366635943538 0.6918586645610765 0.38842748268845306 0.9933627076331204 0.46850099246542154 0.3984608244808865 0.20516931901163726 0.4372573365483021 0.9611159179459008 0.5712676774915255 0.997790654682295 0.43299704553182505 0.9774170861685836 0.8711961146375538 0.09470514204833402 0.6991891706778617 0.8324122205788518 0.5548888188504728 0.22903979685536302 0.39992972092316914 0.6472893846712933 0.7983619967337023 0.4982694787098878 0.9384702445934423 0.4796846925859237 0.17769540501346248 0.3243012011782518 0.6244394908478914 0.27309141326660247 0.020665865636145586 0.19692547007015415 0.05746416318204006 0.9624281225684252 0.9990339113804512 0.23118053641888503 0.34291659797633267 0.8779949747653351 0.963390567515594 0.31125240654298625 0.4303840396371794 0.7045380100674428 0.8052794638711345 0.2170234163614202 0.08264311820207215 0.7644283229689861 0.9717310355173854 0.3569266997162528 0.25283377203964497 0.47312739370635803 0.3932937962594647 0.46328125114950747 0.421707749948931 0.859901521472825 0.45554101521682844 0.33389982177019584 0.335829633258961 0.47808907715035276 0.47694035609408547 0.3069530421968263 0.7429286377712843 0.7692871465627018 0.5190504436347319 0.03737576355009309]
matrica_unif: 
[0.6151176152130708 0.265359809428096; 0.9144889743323608 0.4613984579393007; 0.09968925685602459 0.7993484630937622; 0.15145288883358665 0.3948111494212798]
In [24]:
#TORKE

#Torke su struktura podataka koji su veoma slični nizovima, međutim postoje neke značajne razlike. Prva i najvažnija 
#razlika jeste ta da su koordinate torki nepromenljive, što kod nizova nije slučaj. Druga razlika je sintaksne 
#prirode: torke se označavaju običnim zagradama i njene koordinate moraju biti odvojene zapetom. Indeksiranje 
#počinje od 1.

#Primer jedne torke:

torka_primer1 = tuple(4, 10, 55)
Out[24]:
(4, 10, 55)
In [25]:
#Možemo vršiti pristup tačno jednom elementu torke ili elementima torke čiji indeksi pripadaju određenim opsezima:
torka_primer1 = tuple(4, 10, 55, 800, 890, 90000);
println("Element torke na poziciji 3 je: ",torka_primer1[3])
println("Elementi torke počev od pozicije 3 su: ",torka_primer1[3:end])
Element torke na poziciji 3 je: 55
Elementi torke počev od pozicije 3 su: (55, 800, 890, 90000)
In [26]:
#SKUPOVI

#Skupovi u programskim jezicima predstavljaju sastav od vise elemenata, koji su jedinstveni, i kod kojih poredak
#nije bitan.

#Skup se može formirati na sledeći način:

skup_kategorija = Set{String}(["prva","druga","treća"])
Out[26]:
Set{String} with 3 elements:
  "treća"
  "prva"
  "druga"
In [30]:
# Sa nizovima možemo vršiti različite operacije. One koje su nam od najvećeg značaja jesu operacija pripadnosti nekog
#elementa našem skupu, kao i osnovne skupovne operacije unije, preseka i razlike:

#pripadnost skupu
in("druga", skup_kategorija), #operator , se može koristiti za ispisivanje rezultata više redova koji nisu 
in("cetvrta", skup_kategorija) # zatvoreni sa ; u jednoj torci, redom kojim su navedeni
Out[30]:
(true, false)
In [32]:
kategorije2_skup = Set{String}(["prva","peta","treća"]);
#presek
intersect(skup_kategorija, kategorije2_skup)
Out[32]:
Set{String} with 2 elements:
  "treća"
  "prva"
In [33]:
#unija
union(skup_kategorija, kategorije2_skup)
Out[33]:
Set{String} with 4 elements:
  "peta"
  "treća"
  "prva"
  "druga"
In [34]:
#razlika
setdiff(skup_kategorija, kategorije2_skup)
Out[34]:
Set{String} with 1 element:
  "druga"
In [ ]: